import React from 'react';

import { KeepAlive } from 'umi';
const KeepAliveHoc = (WrappedComponent: React.FC<any>) => {
  return (props: any) => {
    const { location } = props;
    return (
      <KeepAlive saveScrollPosition="screen" name={location.pathname}>
        <WrappedComponent {...props} />
      </KeepAlive>
    );
  };
};

export default KeepAliveHoc;
